package com.agp.mapper;

import com.agp.dto.UerPageQueryDTO;
import com.agp.dto.UpdateUserDTO;
import com.agp.dto.UserRegisterDTO;
import com.agp.entity.User;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface UserMapper {


    //用户密码登录
    @Select("select * from users where phone=#{phone}")
    User selectUserByPhone(String phone);

    //用户注册
    @Select("insert into users(phone,password,nickname) values(#{phone},#{password},#{nickname})")
    void insert(UserRegisterDTO userRegisterDTO);

    //查询用户角色
    @Select("select role from users where id=#{currentId}")
    Integer selectRoleById(Long currentId);

    @Select("SELECT * FROM users WHERE id = #{id}")
    User findById(Long id);

    //更新用户信息
    void updateUserInfo(User user);

    //根据id查询用户信息
    @Select("SELECT * FROM users WHERE id = #{currentId}")
    User seletUserById(Long currentId);

    //分页查询用户信息
    Page<User> page(UerPageQueryDTO pageQueryDTO);

    //更新用户状态

    void updateUserStatus(UpdateUserDTO updateUserDTO);
}

